﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using YasharEl.Infrastructure.Core.Prototype;
using YasharEl.Infrastructure.EntityModel;

namespace YasharEl.Infrastructure.Core.EntityModel.Prototype
{
    public abstract class AbstractPropertyInstanceValueEntity<T> : Entity, IPropertyInstanceValue<T>
    {
        #region IPropertyInstanceValue Implementation

        public virtual long PropertyInstanceValueId
        {
            get;
            set;
        }

        #endregion

        #region AbstractEntity<long> Overrides

        public override long Id
        {
            get
            {
                return PropertyInstanceValueId;
            }
            protected set
            {
                PropertyInstanceValueId = value;
            }
        }

        #endregion

        #region IPropertyInstanceValue<T> Implementation

        public virtual T RealValue
        {
            get;
            set;
        }

        #endregion

        #region IPropertyInstanceValue Implementation

        object IPropertyInstanceValue.RealValue
        {
            get
            {
                return RealValue;
            }
            set
            {
                RealValue = (T)value;
            }
        }

        #endregion
    }
}
